<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>学期工作量统计表</title>
<!-- <link rel="stylesheet" data-th-href="@{../static/bootstrap/css/bootstrap.css}">
<link rel="stylesheet" data-th-href="@{../static/bootstrap/css/bootstrap-theme.css}">
<link rel="stylesheet" th:href="@{../webjars/bootstrap-table/1.9.1-1/bootstrap-table.css}">
<link rel="stylesheet" th:href="@{../webjars/bootstrap-select/2.0.0-beta1/dist/css/bootstrap-select.css}">
<link data-th-href="@{../webjars/bootstrapvalidator/css/bootstrapValidator.css}"	rel="stylesheet" />
<script type="text/javascript"	data-th-src="@{../static/bootstrap/js/jquery-3.3.1.min.js}"></script>
<script data-th-src="@{../webjars/knockout/knockout.js}" type="text/javascript"></script>
<script	data-th-src="@{../webjars/knockout-mapping/2.4.1/knockout.mapping.js}" type="text/javascript"></script>
<script type="text/javascript" data-th-src="@{../static/bootstrap/js/bootstrap.min.js}"></script>
<script type="text/javascript" 	th:src="@{../webjars/bootstrap-select/2.0.0-beta1/dist/js/bootstrap-select.js}"></script>
<script type="text/javascript" th:src="@{../webjars/bootstrap-select/2.0.0-beta1/dist/js/i18n/defaults-zh_CN.js}"></script>
<script	data-th-src="@{../webjars/bootstrapvalidator/js/bootstrapValidator.js}"></script>
<script data-th-src="@{../webjars/bootstrap-table/bootstrap-table.js}"></script>
<script	data-th-src="@{../webjars/bootstrap-table/locale/bootstrap-table-zh-CN.js}"></script>
<script data-th-src="@{../webjars/bootbox/4.4.0/bootbox.js}"></script>
<script type="text/javascript" src="../static/bootstrap-table/knockout.bootstrapTable.ljc.js"></script>
 -->
</head>
<body>
	<div id="teacher_table_div" class="container-fluid">
	
		<!-- 查询窗口 -->
		<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
           	<div class="modal-dialog" role="document">
                <div class="modal-content">
	                <div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
						<h4 class="modal-title" id="myModalLabel">查询</h4>
	                </div>
	               	<div class="modal-body">
	            	<!-- 以下为要查询的的内容 -->
	                    <div class="form-group">
	                        <p>学期与学期不可同时选择</p>
	                        <label for="search_year">学年</label>
	                        <select id="search_year" class="form-control" onchange="term('', this.value);" data-live-search="true" data-style="btn-primary" name="year" data-bind="value:queryCondition.year">
							<option value="">--选择学年--</option>
							<option th:each="k:${allYear}" th:text="${k}" th:value="${k}"></option>
						</select>
	                        <label for="search_term">学期</label>
	                        <select id="search_term" onchange="term(this.value, '');" class="form-control" data-live-search="true" data-style="btn-primary" name="term" data-bind="value:queryCondition.term">
							<option value="">--选择学期--</option>
							<option th:each="k:${allTerm}" th:text="${k}" th:value="${k}"></option>
						</select> 
	                    </div>
	                <!-- 以上为要查询的内容 -->
					</div>
					<div class="modal-footer">
		                <button type="button" class="btn btn-primary" data-dismiss="modal" data-bind="click:queryClick"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>&nbsp;查询</button>
		                <button type="button" class="btn btn-default" data-dismiss="modal" data-bind="click:clearClick" onclick="fun_1();"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span>&nbsp;清空</button>
	            	</div>
                </div>
                
           	</div>
		</div> 
		
		<!-- 工具栏 -->
		<div id="toolbar" class="btn-group">
			<!-- <button data-bind="click:addClick" type="button"
				class="btn btn-default">
				<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
			</button>
			<button data-bind="click:editClick" type="button"
				class="btn btn-default">
				<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改
			</button>
			<button data-bind="click:deleteClick" type="button"
				class="btn btn-default">
				<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
			</button> -->
			<button data-bind="click:searchClick" type="button"
				class="btn btn-default">
				<span class="glyphicon glyphicon-search" aria-hidden="true"></span>查询
			</button>
			
		</div>
		
		<!-- 表格，表头里定义了表要显示的字段，data-formatter 里只能跟一个方法名 -->
		<table id="mytable" data-bind="bootstrapTable:$root">
			<thead>
				<tr>
					<th data-checkbox="true"></th>
					<th data-field="term">学期</th> 
					<th data-field="teacher">教师</th>
					<th data-field="complete">完成工作</th>
					<!-- <th data-field="actualp">实际完成学时</th>
					<th data-field="termperiod">学期总学时</th>
					<th data-field="isdone">是否完成教学</th> -->
				</tr>
			</thead>
		</table>
	</div>
	
<!-- 以下是javascript内容 -->	
<script type="text/javascript">
$(function(){
    var data =  {
	    tableParams : {
	    	url : 'worksheetterm/page'
	    	},
	    	urls : {
	    		delete : 'delete',
	    		update : 'edit',
	    		add : 'edit',
	    		search:'search'
	    	},
	    	queryCondition : {
	    		term : '',
	    		year : ''
	    	}
	};
	ko.applyBindings(new BsTableViewModel(data),document.getElementById('teacher_table_div'));	
	
});

function term(term, year) {
	if(!term.replace(/(^s*)|(s*$)/g, "").length == 0) {
		$("#search_year").prop('disabled', true);
	}
	if(!year.replace(/(^s*)|(s*$)/g, "").length == 0) {
		$("#search_term").prop('disabled', true);
	}
	if(term.replace(/(^s*)|(s*$)/g, "").length == 0 && year.replace(/(^s*)|(s*$)/g, "").length == 0) {
		$("#search_year").prop('disabled', false);
		$("#search_term").prop('disabled', false);
	}
}

function fun_1() {
	$("#search_term").prop('disabled', false);
	$("#search_year").prop('disabled', false);
}

</script>

</body>
</html>